package com.it.zhangjun.arithmetic.贪心;

import java.util.Arrays;

/**
 * @author jun.zhang6
 * @date 2020/10/27
 */
public class 零钱兑换 {
    public static void main(String[] args) {
        Integer[] faces = {25, 10, 5, 1};
        int coins = 0, money = 41;
        Arrays.sort(faces);
        int idx = faces.length - 1;
        while (idx >= 0) {
            while (money >= faces[idx]) {
                money -= faces[idx];
                coins++;
            }
        }
        idx--;
        System.out.println(coins);
    }
}
